#define _CRT_SECURE_NO_WARNINGS 1

#include <iostream>
using namespace std;

int Func(int x)
{
	if (x == 1)
		return 0;
	if (x % 2 == 0)
	{
		return Func(x / 2) + 1;
	}
	else
	{
		return Func(3 * x + 1) +1;
	}
}

int J()
{
	int n = 0, k = 0;
	int count = 0;
	cin >> n >> k;
	while (n > 0)
	{
		if (Func(n) > k)
		{
			count++;
		}
		n--;
	}

	return count;
}

//int main()
//{
//	cout << J() << endl;
//	return 0;
//}